<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
    <title>文件管理系统</title>
    <style>
        .content {
            width: 80%;
            margin: 10px auto;
        }
    </style>
</head>
<body>
<div class="content panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">文件上传与下载</h3>
    </div>

    <div class="panel-body">
        <div class="panel-group">
            <form method="post" enctype="multipart/form-data" th:action="@{/upload-file/upload}">
            <input type="file" name="multipartFile">
            <input type="submit" style="margin-top: 20px" value="点击上传" class="btn btn-primary btn-sm">
            </form>
        </div>

        <table class="table panel-bordered">
            <tr>
                <td>文件原名称</td>
                <td>文件新名称</td>
                <td>存储路径</td>
                <td>文件大小</td>
                <td>文件类型</td>
                <td>上传时间</td>
                <td>操作</td>
            </tr>
            <tr th:each="file:${fileList}">
            <td class="td_style" th:text="${file.oldName}"></td>
            <td class="td_style" th:text="${file.newName}"></td>
            <td class="td_style" th:text="${file.urlPath}"></td>
            <td class="td_style" th:text="${file.size}"></td>
            <td class="td_style" th:text="${file.fileType}"></td>
            <td class="td_style" th:text="${#dates.format(file.createdTime,'yyyy-MM-dd-HH:mm:ss')}"></td>
                <td>
                    <a class="btn btn-success" role="button" th:href="@{/upload-file/download(id=${file.id})}">下载</a>
                    <a class="btn btn-danger" role="button" th:href="@{/upload-file/delete(id=${file.id})}">删除</a>
                </td>
            </tr>
        </table>
    </div>
</div>

</body>
</html>